package com.zsg.controller;


import com.zsg.pojo.User;
import com.zsg.service.UserService;
import com.zsg.utils.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Gadmin
 */
@Api(value = "用户列表操作接口",tags = "用户操作接口")
@RestController
@RequestMapping("/user")
public class UserController {


    @Autowired
    private ResponseData responseData;

    @Autowired
    private UserService userService;


    @PostMapping("/addUser")
    @ApiOperation("添加用户")
    public ResponseData addUser(@RequestBody  User user){
            responseData = userService.addUser(user);
            return responseData;
    }


    @PostMapping("/delUser")
    @ApiOperation("删除用户，id")
    public ResponseData delUser(@RequestBody  User user){
        responseData = userService.delUser(user);
        return responseData;
    }


    @PostMapping("/updateUser")
    @ApiOperation("修改用户")
    public ResponseData updateUser(@RequestBody  User user){
        responseData = userService.updateUser(user);
        return responseData;
    }


    @GetMapping("/queryUser")
    @ApiOperation("查询用户，  id，username")
    public ResponseData queryUser(@RequestBody  User user){
        responseData = userService.queryUser(user);
        return responseData;
    }
}
